Skip to content

[Issue 2247] fix datatype of vhost:headers from String to Array #2248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

chillinger
Copy link

Fix wrong introduction of Dataype String to headers parameter
The code requires the parameter to be Array[String] to work properly

Fix wrong introduction of Dataype String to headers parameter
The code requires the parameter to be Array[String] to work properly
@chillinger chillinger requested a review from a team as a code owner June 13, 2022 09:54
@puppet-community-rangefinder
Copy link

apache::vhost is a type

Breaking changes to this file WILL impact these 128 modules (exact match):
Breaking changes to this file MAY impact these 35 modules (near match):

This module is declared in 174 of 579 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@CLAassistant
Copy link

CLAassistant commented Jun 13, 2022

CLA assistant check
All committers have signed the CLA.

@david22swan
Copy link
Member

From what I can see this looks to be correct, but could you also update the example in the description so that it matches

@chillinger
Copy link
Author

@david22swan thanks for the review, description is updated

@david22swan
Copy link
Member

@chillinger Look's like your getting some unit test failures.

@@ -1853,7 +1853,7 @@
Optional[Variant[Array[String],String]] $redirectmatch_status = undef,
Optional[Variant[Array[String],String]] $redirectmatch_regexp = undef,
Optional[Variant[Array[String],String]] $redirectmatch_dest = undef,
Optional[String] $headers = undef,
Optional[Array[String]] $headers = undef,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're changing it to an array, I'd say drop the Optional part and make it an empty array by default. I'd also narrow it to non-empty strings:

Suggested change
Optional[Array[String]] $headers = undef,
Array[String[1]] $headers = [],

Then you can simplify templates/vhost/_header.erb a lot too.

You can also drop the if $headers and stick to ! empty($headers) on line 2263.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ekohl I thought about that, but realised the patch the way I did for the following reasons:

  • I only have the time to actually fix the bug which breaks our puppet runs, I did not want to rework more than really necessary
  • every other array type parameter in the module, including $request_headers is an Optional[Array[String]]. I wanted to stay consistent

For those reasons I would like this fix to be accepted. If the datatype should be changed to Array with default [], I would like this seen as an independent rework issue

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think it should be fixed so I opened #2251.

@david22swan
Copy link
Member

@chillinger Apologies, but after some discussion within the team we have decided to go ahead with the changes proposed by @ekohl rather than your own, as they are more comprehensive and represent a larger improvement to the module.
From what I can see they should still solve your issue and we hope to get them merged in soon.
I am sorry for any inconvenience this has caused you, and while we could not merge your work at this time we hope to see more from you in the future ad thank you for bringing this issue to our attention.

@chillinger
Copy link
Author

@david22swan @ekohl no problem at all, I'm happy an even better solution arose from my initial proposal!

@david22swan
Copy link
Member

@chillinger Closing this as Ekohl's pr has been merged.
Thank's again for the work you put in bringing this to our attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants